/********************************************************************
FileName    :   Dal_xskdh.cs
CreateTime  :   2019-01-17 01:01
BaseClass   :   Dal_xskdh
FileType    :   .cs
Author      :  minjie
Description :   Dal_xskdhDAL层（简单三层）
*********************************************************************/

using System;
using System.Text;
using System.Data.SqlClient;
using System.Collections.Generic;

using System.Data;
using HT.DBUtility;

namespace HT.DAL
{
	/// <summary>
	/// Dal_xskdh的摘要说明。
	/// </summary>
	public partial class Dal_xskdh 
  	{ 
     		      
  		public bool Exists() 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("select count(1) from xskdh"); 
           SqlParameter[] parameters = { };  
          			return DbHelperSQL.Exists(strSql.ToString(),parameters); 
  		} 
  		 
  				 
  		 
  		/// <summary> 
  		/// 增加一条数据 
  		/// </summary> 
  		public  bool  Add(xskdh_Entity model) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("insert into xskdh(");			 
  	        strSql.Append("DjLsh,DjBtZdh,DjFtZdh,DjStZdh,DjState,DjCount,rq,sj,djzt,xsdh,Bmbh,Bmmc,yyybh,yyymc,khbh,khmc,hyk,hykxf,slhj,jehj,xj,zrje,bqjf,Zjf,bz,djyh,djsj,xgyh,xgsj,cszt,yl,SalesStatus,Syybh,Syymc,ssjehj,yhk,wx,zfb,djq) values ("); 
  	        strSql.Append("	@DjLsh,@DjBtZdh,@DjFtZdh,@DjStZdh,@DjState,@DjCount,@rq,@sj,@djzt,@xsdh,@Bmbh,@Bmmc,@yyybh,@yyymc,@khbh,@khmc,@hyk,@hykxf,@slhj,@jehj,@xj,@zrje,@bqjf,@Zjf,@bz,@djyh,@djsj,@xgyh,@xgsj,@cszt,@yl,@SalesStatus,@Syybh,@Syymc,@ssjehj,@yhk,@wx,@zfb,@djq	 ) "); 
  			SqlParameter[] parameters = { 
              new SqlParameter("@DjLsh", SqlDbType.Int,4) ,              
              new SqlParameter("@DjBtZdh", SqlDbType.Int,4) ,              
              new SqlParameter("@DjFtZdh", SqlDbType.Int,4) ,              
              new SqlParameter("@DjStZdh", SqlDbType.Int,4) ,              
              new SqlParameter("@DjState", SqlDbType.Char,10) ,              
              new SqlParameter("@DjCount", SqlDbType.Int,4) ,              
              new SqlParameter("@rq", SqlDbType.DateTime) ,              
              new SqlParameter("@sj", SqlDbType.DateTime) ,              
              new SqlParameter("@djzt", SqlDbType.VarChar,50) ,              
              new SqlParameter("@xsdh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@Bmbh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@Bmmc", SqlDbType.VarChar,50) ,              
              new SqlParameter("@yyybh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@yyymc", SqlDbType.VarChar,50) ,              
              new SqlParameter("@khbh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@khmc", SqlDbType.VarChar,50) ,              
              new SqlParameter("@hyk", SqlDbType.VarChar,50) ,              
              new SqlParameter("@hykxf", SqlDbType.Decimal,9) ,              
              new SqlParameter("@slhj", SqlDbType.Decimal,9) ,              
              new SqlParameter("@jehj", SqlDbType.Money) ,              
              new SqlParameter("@xj", SqlDbType.Money) ,              
              new SqlParameter("@zrje", SqlDbType.Money) ,              
              new SqlParameter("@bqjf", SqlDbType.Decimal,9) ,              
              new SqlParameter("@Zjf", SqlDbType.Decimal,9) ,              
              new SqlParameter("@bz", SqlDbType.VarChar,50) ,              
              new SqlParameter("@djyh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@djsj", SqlDbType.DateTime) ,              
              new SqlParameter("@xgyh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@xgsj", SqlDbType.DateTime) ,              
              new SqlParameter("@cszt", SqlDbType.Int,4) ,              
              new SqlParameter("@yl", SqlDbType.Decimal,9) ,              
              new SqlParameter("@SalesStatus", SqlDbType.Int,4) ,              
              new SqlParameter("@Syybh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@Syymc", SqlDbType.VarChar,50) ,              
              new SqlParameter("@ssjehj", SqlDbType.Decimal,9) ,              
              new SqlParameter("@yhk", SqlDbType.Decimal,9) ,              
              new SqlParameter("@wx", SqlDbType.Money) ,              
              new SqlParameter("@zfb", SqlDbType.Money) ,              
              new SqlParameter("@djq", SqlDbType.Money)};             
              parameters[0].Value = model.DjLsh;  
              
              parameters[1].Value = model.DjBtZdh;  
              
              parameters[2].Value = model.DjFtZdh;  
              
              parameters[3].Value = model.DjStZdh;  
              
           if (model.DjState != null)  
              parameters[4].Value = model.DjState;  
           else  
              parameters[4].Value = DBNull.Value;  
              
              parameters[5].Value = model.DjCount;  
              
           if (model.rq != null)  
              parameters[6].Value = model.rq;  
           else  
              parameters[6].Value = DBNull.Value;  
              
           if (model.sj != null)  
              parameters[7].Value = model.sj;  
           else  
              parameters[7].Value = DBNull.Value;  
              
           if (model.djzt != null)  
              parameters[8].Value = model.djzt;  
           else  
              parameters[8].Value = DBNull.Value;  
              
           if (model.xsdh != null)  
              parameters[9].Value = model.xsdh;  
           else  
              parameters[9].Value = DBNull.Value;  
              
           if (model.Bmbh != null)  
              parameters[10].Value = model.Bmbh;  
           else  
              parameters[10].Value = DBNull.Value;  
              
           if (model.Bmmc != null)  
              parameters[11].Value = model.Bmmc;  
           else  
              parameters[11].Value = DBNull.Value;  
              
           if (model.yyybh != null)  
              parameters[12].Value = model.yyybh;  
           else  
              parameters[12].Value = DBNull.Value;  
              
           if (model.yyymc != null)  
              parameters[13].Value = model.yyymc;  
           else  
              parameters[13].Value = DBNull.Value;  
              
           if (model.khbh != null)  
              parameters[14].Value = model.khbh;  
           else  
              parameters[14].Value = DBNull.Value;  
              
           if (model.khmc != null)  
              parameters[15].Value = model.khmc;  
           else  
              parameters[15].Value = DBNull.Value;  
              
           if (model.hyk != null)  
              parameters[16].Value = model.hyk;  
           else  
              parameters[16].Value = DBNull.Value;  
              
           if (model.hykxf != null)  
              parameters[17].Value = model.hykxf;  
           else  
              parameters[17].Value = DBNull.Value;  
              
           if (model.slhj != null)  
              parameters[18].Value = model.slhj;  
           else  
              parameters[18].Value = DBNull.Value;  
              
           if (model.jehj != null)  
              parameters[19].Value = model.jehj;  
           else  
              parameters[19].Value = DBNull.Value;  
              
           if (model.xj != null)  
              parameters[20].Value = model.xj;  
           else  
              parameters[20].Value = DBNull.Value;  
              
           if (model.zrje != null)  
              parameters[21].Value = model.zrje;  
           else  
              parameters[21].Value = DBNull.Value;  
              
           if (model.bqjf != null)  
              parameters[22].Value = model.bqjf;  
           else  
              parameters[22].Value = DBNull.Value;  
              
           if (model.Zjf != null)  
              parameters[23].Value = model.Zjf;  
           else  
              parameters[23].Value = DBNull.Value;  
              
           if (model.bz != null)  
              parameters[24].Value = model.bz;  
           else  
              parameters[24].Value = DBNull.Value;  
              
           if (model.djyh != null)  
              parameters[25].Value = model.djyh;  
           else  
              parameters[25].Value = DBNull.Value;  
              
           if (model.djsj != null)  
              parameters[26].Value = model.djsj;  
           else  
              parameters[26].Value = DBNull.Value;  
              
           if (model.xgyh != null)  
              parameters[27].Value = model.xgyh;  
           else  
              parameters[27].Value = DBNull.Value;  
              
           if (model.xgsj != null)  
              parameters[28].Value = model.xgsj;  
           else  
              parameters[28].Value = DBNull.Value;  
              
              parameters[29].Value = model.cszt;  
              
           if (model.yl != null)  
              parameters[30].Value = model.yl;  
           else  
              parameters[30].Value = DBNull.Value;  
              
              parameters[31].Value = model.SalesStatus;  
              
           if (model.Syybh != null)  
              parameters[32].Value = model.Syybh;  
           else  
              parameters[32].Value = DBNull.Value;  
              
           if (model.Syymc != null)  
              parameters[33].Value = model.Syymc;  
           else  
              parameters[33].Value = DBNull.Value;  
              
           if (model.ssjehj != null)  
              parameters[34].Value = model.ssjehj;  
           else  
              parameters[34].Value = DBNull.Value;  
              
           if (model.yhk != null)  
              parameters[35].Value = model.yhk;  
           else  
              parameters[35].Value = DBNull.Value;  
              
           if (model.wx != null)  
              parameters[36].Value = model.wx;  
           else  
              parameters[36].Value = DBNull.Value;  
              
           if (model.zfb != null)  
              parameters[37].Value = model.zfb;  
           else  
              parameters[37].Value = DBNull.Value;  
              
           if (model.djq != null)  
              parameters[38].Value = model.djq;  
           else  
              parameters[38].Value = DBNull.Value;  
              
  			int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);			 
  			if (rows > 0) 
  			{ 
  				return true; 
  			} 
  			else 
  			{ 
              return false;; 
           }  
  		} 
  		 
  		/// <summary> 
  		/// 增加一条数据(字符串) 
  		/// </summary> 
  		public  string  AddStr(xskdh_Entity model) 
  		{ 
  				if(model.DjLsh==null) 
  				{ 
  					model.DjLsh=0; 
  				} 
  				if(model.DjBtZdh==null) 
  				{ 
  					model.DjBtZdh=0; 
  				} 
  				if(model.DjFtZdh==null) 
  				{ 
  					model.DjFtZdh=0; 
  				} 
  				if(model.DjStZdh==null) 
  				{ 
  					model.DjStZdh=0; 
  				} 
  				if(model.DjState==null) 
  				{ 
  					model.DjState="";  
  				} 
  				if(model.DjCount==null) 
  				{ 
  					model.DjCount=0; 
  				} 
  				if(model.djzt==null) 
  				{ 
  					model.djzt="";  
  				} 
  				if(model.xsdh==null) 
  				{ 
  					model.xsdh="";  
  				} 
  				if(model.Bmbh==null) 
  				{ 
  					model.Bmbh="";  
  				} 
  				if(model.Bmmc==null) 
  				{ 
  					model.Bmmc="";  
  				} 
  				if(model.yyybh==null) 
  				{ 
  					model.yyybh="";  
  				} 
  				if(model.yyymc==null) 
  				{ 
  					model.yyymc="";  
  				} 
  				if(model.khbh==null) 
  				{ 
  					model.khbh="";  
  				} 
  				if(model.khmc==null) 
  				{ 
  					model.khmc="";  
  				} 
  				if(model.hyk==null) 
  				{ 
  					model.hyk="";  
  				} 
  				if(model.hykxf==null) 
  				{ 
  					model.hykxf=0; 
  				} 
  				if(model.slhj==null) 
  				{ 
  					model.slhj=0; 
  				} 
  				if(model.jehj==null) 
  				{ 
  					model.jehj=0; 
  				} 
  				if(model.xj==null) 
  				{ 
  					model.xj=0; 
  				} 
  				if(model.zrje==null) 
  				{ 
  					model.zrje=0; 
  				} 
  				if(model.bqjf==null) 
  				{ 
  					model.bqjf=0; 
  				} 
  				if(model.Zjf==null) 
  				{ 
  					model.Zjf=0; 
  				} 
  				if(model.bz==null) 
  				{ 
  					model.bz="";  
  				} 
  				if(model.djyh==null) 
  				{ 
  					model.djyh="";  
  				} 
  				if(model.xgyh==null) 
  				{ 
  					model.xgyh="";  
  				} 
  				if(model.cszt==null) 
  				{ 
  					model.cszt=0; 
  				} 
  				if(model.yl==null) 
  				{ 
  					model.yl=0; 
  				} 
  				if(model.SalesStatus==null) 
  				{ 
  					model.SalesStatus=0; 
  				} 
  				if(model.Syybh==null) 
  				{ 
  					model.Syybh="";  
  				} 
  				if(model.Syymc==null) 
  				{ 
  					model.Syymc="";  
  				} 
  				if(model.ssjehj==null) 
  				{ 
  					model.ssjehj=0; 
  				} 
  				if(model.yhk==null) 
  				{ 
  					model.yhk=0; 
  				} 
  				if(model.wx==null) 
  				{ 
  					model.wx=0; 
  				} 
  				if(model.zfb==null) 
  				{ 
  					model.zfb=0; 
  				} 
  				if(model.djq==null) 
  				{ 
  					model.djq=0; 
  				} 
  		 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("insert into xskdh(");			 
  	        strSql.Append("DjLsh,DjBtZdh,DjFtZdh,DjStZdh,DjState,DjCount,rq,sj,djzt,xsdh,Bmbh,Bmmc,yyybh,yyymc,khbh,khmc,hyk,hykxf,slhj,jehj,xj,zrje,bqjf,Zjf,bz,djyh,djsj,xgyh,xgsj,cszt,yl,SalesStatus,Syybh,Syymc,ssjehj,yhk,wx,zfb,djq) values ("); 
  	        strSql.Append("	"+ model.DjLsh+","+ model.DjBtZdh+","+ model.DjFtZdh+","+ model.DjStZdh+",'"+ model.DjState+"',"+ model.DjCount+",'"+ model.rq+"','"+ model.sj+"','"+ model.djzt+"','"+ model.xsdh+"','"+ model.Bmbh+"','"+ model.Bmmc+"','"+ model.yyybh+"','"+ model.yyymc+"','"+ model.khbh+"','"+ model.khmc+"','"+ model.hyk+"',"+ model.hykxf+","+ model.slhj+","+ model.jehj+","+ model.xj+","+ model.zrje+","+ model.bqjf+","+ model.Zjf+",'"+ model.bz+"','"+ model.djyh+"','"+ model.djsj+"','"+ model.xgyh+"','"+ model.xgsj+"',"+ model.cszt+","+ model.yl+","+ model.SalesStatus+",'"+ model.Syybh+"','"+ model.Syymc+"',"+ model.ssjehj+","+ model.yhk+","+ model.wx+","+ model.zfb+"," +model.djq+"	 ) "); 
           return strSql.ToString(); 
  		} 
  		 
  		 
  		/// <summary> 
  		/// 更新一条数据 
  		/// </summary> 
  		public bool Update(xskdh_Entity model) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("update xskdh set "); 
                      strSql.Append(" DjLsh = @DjLsh,"); 
              strSql.Append(" DjBtZdh = @DjBtZdh,"); 
              strSql.Append(" DjFtZdh = @DjFtZdh,"); 
              strSql.Append(" DjStZdh = @DjStZdh,"); 
              strSql.Append(" DjState = @DjState,"); 
              strSql.Append(" DjCount = @DjCount,"); 
              strSql.Append(" rq = @rq,"); 
              strSql.Append(" sj = @sj,"); 
              strSql.Append(" djzt = @djzt,"); 
              strSql.Append(" xsdh = @xsdh,"); 
              strSql.Append(" Bmbh = @Bmbh,"); 
              strSql.Append(" Bmmc = @Bmmc,"); 
              strSql.Append(" yyybh = @yyybh,"); 
              strSql.Append(" yyymc = @yyymc,"); 
              strSql.Append(" khbh = @khbh,"); 
              strSql.Append(" khmc = @khmc,"); 
              strSql.Append(" hyk = @hyk,"); 
              strSql.Append(" hykxf = @hykxf,"); 
              strSql.Append(" slhj = @slhj,"); 
              strSql.Append(" jehj = @jehj,"); 
              strSql.Append(" xj = @xj,"); 
              strSql.Append(" zrje = @zrje,"); 
              strSql.Append(" bqjf = @bqjf,"); 
              strSql.Append(" Zjf = @Zjf,"); 
              strSql.Append(" bz = @bz,"); 
              strSql.Append(" djyh = @djyh,"); 
              strSql.Append(" djsj = @djsj,"); 
              strSql.Append(" xgyh = @xgyh,"); 
              strSql.Append(" xgsj = @xgsj,"); 
              strSql.Append(" cszt = @cszt,"); 
              strSql.Append(" yl = @yl,"); 
              strSql.Append(" SalesStatus = @SalesStatus,"); 
              strSql.Append(" Syybh = @Syybh,"); 
              strSql.Append(" Syymc = @Syymc,"); 
              strSql.Append(" ssjehj = @ssjehj,"); 
              strSql.Append(" yhk = @yhk,"); 
              strSql.Append(" wx = @wx,"); 
              strSql.Append(" zfb = @zfb,"); 
              strSql.Append(" djq = @djq"); 
  			strSql.Append(" where   "); 
  						 
           SqlParameter[] parameters = { 
                      new SqlParameter("@DjLsh", SqlDbType.Int,4) ,              
              new SqlParameter("@DjBtZdh", SqlDbType.Int,4) ,              
              new SqlParameter("@DjFtZdh", SqlDbType.Int,4) ,              
              new SqlParameter("@DjStZdh", SqlDbType.Int,4) ,              
              new SqlParameter("@DjState", SqlDbType.Char,10) ,              
              new SqlParameter("@DjCount", SqlDbType.Int,4) ,              
              new SqlParameter("@rq", SqlDbType.DateTime) ,              
              new SqlParameter("@sj", SqlDbType.DateTime) ,              
              new SqlParameter("@djzt", SqlDbType.VarChar,50) ,              
              new SqlParameter("@xsdh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@Bmbh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@Bmmc", SqlDbType.VarChar,50) ,              
              new SqlParameter("@yyybh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@yyymc", SqlDbType.VarChar,50) ,              
              new SqlParameter("@khbh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@khmc", SqlDbType.VarChar,50) ,              
              new SqlParameter("@hyk", SqlDbType.VarChar,50) ,              
              new SqlParameter("@hykxf", SqlDbType.Decimal,9) ,              
              new SqlParameter("@slhj", SqlDbType.Decimal,9) ,              
              new SqlParameter("@jehj", SqlDbType.Money) ,              
              new SqlParameter("@xj", SqlDbType.Money) ,              
              new SqlParameter("@zrje", SqlDbType.Money) ,              
              new SqlParameter("@bqjf", SqlDbType.Decimal,9) ,              
              new SqlParameter("@Zjf", SqlDbType.Decimal,9) ,              
              new SqlParameter("@bz", SqlDbType.VarChar,50) ,              
              new SqlParameter("@djyh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@djsj", SqlDbType.DateTime) ,              
              new SqlParameter("@xgyh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@xgsj", SqlDbType.DateTime) ,              
              new SqlParameter("@cszt", SqlDbType.Int,4) ,              
              new SqlParameter("@yl", SqlDbType.Decimal,9) ,              
              new SqlParameter("@SalesStatus", SqlDbType.Int,4) ,              
              new SqlParameter("@Syybh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@Syymc", SqlDbType.VarChar,50) ,              
              new SqlParameter("@ssjehj", SqlDbType.Decimal,9) ,              
              new SqlParameter("@yhk", SqlDbType.Decimal,9) ,              
              new SqlParameter("@wx", SqlDbType.Money) ,              
              new SqlParameter("@zfb", SqlDbType.Money) ,              
              new SqlParameter("@djq", SqlDbType.Money)};             
                   if (model.DjLsh != null)  
              parameters[0].Value = model.DjLsh;  
           else  
              parameters[0].Value = DBNull.Value;  
              
           if (model.DjBtZdh != null)  
              parameters[1].Value = model.DjBtZdh;  
           else  
              parameters[1].Value = DBNull.Value;  
              
           if (model.DjFtZdh != null)  
              parameters[2].Value = model.DjFtZdh;  
           else  
              parameters[2].Value = DBNull.Value;  
              
           if (model.DjStZdh != null)  
              parameters[3].Value = model.DjStZdh;  
           else  
              parameters[3].Value = DBNull.Value;  
              
           if (model.DjState != null)  
              parameters[4].Value = model.DjState;  
           else  
              parameters[4].Value = DBNull.Value;  
              
           if (model.DjCount != null)  
              parameters[5].Value = model.DjCount;  
           else  
              parameters[5].Value = DBNull.Value;  
              
           if (model.rq != null)  
              parameters[6].Value = model.rq;  
           else  
              parameters[6].Value = DBNull.Value;  
              
           if (model.sj != null)  
              parameters[7].Value = model.sj;  
           else  
              parameters[7].Value = DBNull.Value;  
              
           if (model.djzt != null)  
              parameters[8].Value = model.djzt;  
           else  
              parameters[8].Value = DBNull.Value;  
              
           if (model.xsdh != null)  
              parameters[9].Value = model.xsdh;  
           else  
              parameters[9].Value = DBNull.Value;  
              
           if (model.Bmbh != null)  
              parameters[10].Value = model.Bmbh;  
           else  
              parameters[10].Value = DBNull.Value;  
              
           if (model.Bmmc != null)  
              parameters[11].Value = model.Bmmc;  
           else  
              parameters[11].Value = DBNull.Value;  
              
           if (model.yyybh != null)  
              parameters[12].Value = model.yyybh;  
           else  
              parameters[12].Value = DBNull.Value;  
              
           if (model.yyymc != null)  
              parameters[13].Value = model.yyymc;  
           else  
              parameters[13].Value = DBNull.Value;  
              
           if (model.khbh != null)  
              parameters[14].Value = model.khbh;  
           else  
              parameters[14].Value = DBNull.Value;  
              
           if (model.khmc != null)  
              parameters[15].Value = model.khmc;  
           else  
              parameters[15].Value = DBNull.Value;  
              
           if (model.hyk != null)  
              parameters[16].Value = model.hyk;  
           else  
              parameters[16].Value = DBNull.Value;  
              
           if (model.hykxf != null)  
              parameters[17].Value = model.hykxf;  
           else  
              parameters[17].Value = DBNull.Value;  
              
           if (model.slhj != null)  
              parameters[18].Value = model.slhj;  
           else  
              parameters[18].Value = DBNull.Value;  
              
           if (model.jehj != null)  
              parameters[19].Value = model.jehj;  
           else  
              parameters[19].Value = DBNull.Value;  
              
           if (model.xj != null)  
              parameters[20].Value = model.xj;  
           else  
              parameters[20].Value = DBNull.Value;  
              
           if (model.zrje != null)  
              parameters[21].Value = model.zrje;  
           else  
              parameters[21].Value = DBNull.Value;  
              
           if (model.bqjf != null)  
              parameters[22].Value = model.bqjf;  
           else  
              parameters[22].Value = DBNull.Value;  
              
           if (model.Zjf != null)  
              parameters[23].Value = model.Zjf;  
           else  
              parameters[23].Value = DBNull.Value;  
              
           if (model.bz != null)  
              parameters[24].Value = model.bz;  
           else  
              parameters[24].Value = DBNull.Value;  
              
           if (model.djyh != null)  
              parameters[25].Value = model.djyh;  
           else  
              parameters[25].Value = DBNull.Value;  
              
           if (model.djsj != null)  
              parameters[26].Value = model.djsj;  
           else  
              parameters[26].Value = DBNull.Value;  
              
           if (model.xgyh != null)  
              parameters[27].Value = model.xgyh;  
           else  
              parameters[27].Value = DBNull.Value;  
              
           if (model.xgsj != null)  
              parameters[28].Value = model.xgsj;  
           else  
              parameters[28].Value = DBNull.Value;  
              
           if (model.cszt != null)  
              parameters[29].Value = model.cszt;  
           else  
              parameters[29].Value = DBNull.Value;  
              
           if (model.yl != null)  
              parameters[30].Value = model.yl;  
           else  
              parameters[30].Value = DBNull.Value;  
              
           if (model.SalesStatus != null)  
              parameters[31].Value = model.SalesStatus;  
           else  
              parameters[31].Value = DBNull.Value;  
              
           if (model.Syybh != null)  
              parameters[32].Value = model.Syybh;  
           else  
              parameters[32].Value = DBNull.Value;  
              
           if (model.Syymc != null)  
              parameters[33].Value = model.Syymc;  
           else  
              parameters[33].Value = DBNull.Value;  
              
           if (model.ssjehj != null)  
              parameters[34].Value = model.ssjehj;  
           else  
              parameters[34].Value = DBNull.Value;  
              
           if (model.yhk != null)  
              parameters[35].Value = model.yhk;  
           else  
              parameters[35].Value = DBNull.Value;  
              
           if (model.wx != null)  
              parameters[36].Value = model.wx;  
           else  
              parameters[36].Value = DBNull.Value;  
              
           if (model.zfb != null)  
              parameters[37].Value = model.zfb;  
           else  
              parameters[37].Value = DBNull.Value;  
              
           if (model.djq != null)  
              parameters[38].Value = model.djq;  
           else  
              parameters[38].Value = DBNull.Value;  
              
           int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters); 
  			if (rows > 0) 
  			{ 
  				return true; 
  			} 
  			else 
  			{ 
  				return false; 
  			} 
  		} 
  		 
  		 
  		/// <summary> 
  		/// 更新一条数据(字符串) 2016-07-13更新 
  		///   2017-03-23更新 minjie 
  		/// </summary> 
  		public  string  UpdateStr(xskdh_Entity model) 
  		{ 
  				if(model.DjLsh==null) 
  				{ 
  					model.DjLsh=0; 
  				} 
  				if(model.DjBtZdh==null) 
  				{ 
  					model.DjBtZdh=0; 
  				} 
  				if(model.DjFtZdh==null) 
  				{ 
  					model.DjFtZdh=0; 
  				} 
  				if(model.DjStZdh==null) 
  				{ 
  					model.DjStZdh=0; 
  				} 
  				if(model.DjState==null) 
  				{ 
  					model.DjState="";  
  				} 
  				if(model.DjCount==null) 
  				{ 
  					model.DjCount=0; 
  				} 
  				if(model.djzt==null) 
  				{ 
  					model.djzt="";  
  				} 
  				if(model.xsdh==null) 
  				{ 
  					model.xsdh="";  
  				} 
  				if(model.Bmbh==null) 
  				{ 
  					model.Bmbh="";  
  				} 
  				if(model.Bmmc==null) 
  				{ 
  					model.Bmmc="";  
  				} 
  				if(model.yyybh==null) 
  				{ 
  					model.yyybh="";  
  				} 
  				if(model.yyymc==null) 
  				{ 
  					model.yyymc="";  
  				} 
  				if(model.khbh==null) 
  				{ 
  					model.khbh="";  
  				} 
  				if(model.khmc==null) 
  				{ 
  					model.khmc="";  
  				} 
  				if(model.hyk==null) 
  				{ 
  					model.hyk="";  
  				} 
  				if(model.hykxf==null) 
  				{ 
  					model.hykxf=0; 
  				} 
  				if(model.slhj==null) 
  				{ 
  					model.slhj=0; 
  				} 
  				if(model.jehj==null) 
  				{ 
  					model.jehj=0; 
  				} 
  				if(model.xj==null) 
  				{ 
  					model.xj=0; 
  				} 
  				if(model.zrje==null) 
  				{ 
  					model.zrje=0; 
  				} 
  				if(model.bqjf==null) 
  				{ 
  					model.bqjf=0; 
  				} 
  				if(model.Zjf==null) 
  				{ 
  					model.Zjf=0; 
  				} 
  				if(model.bz==null) 
  				{ 
  					model.bz="";  
  				} 
  				if(model.djyh==null) 
  				{ 
  					model.djyh="";  
  				} 
  				if(model.xgyh==null) 
  				{ 
  					model.xgyh="";  
  				} 
  				if(model.cszt==null) 
  				{ 
  					model.cszt=0; 
  				} 
  				if(model.yl==null) 
  				{ 
  					model.yl=0; 
  				} 
  				if(model.SalesStatus==null) 
  				{ 
  					model.SalesStatus=0; 
  				} 
  				if(model.Syybh==null) 
  				{ 
  					model.Syybh="";  
  				} 
  				if(model.Syymc==null) 
  				{ 
  					model.Syymc="";  
  				} 
  				if(model.ssjehj==null) 
  				{ 
  					model.ssjehj=0; 
  				} 
  				if(model.yhk==null) 
  				{ 
  					model.yhk=0; 
  				} 
  				if(model.wx==null) 
  				{ 
  					model.wx=0; 
  				} 
  				if(model.zfb==null) 
  				{ 
  					model.zfb=0; 
  				} 
  				if(model.djq==null) 
  				{ 
  					model.djq=0; 
  				} 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("update xskdh set "); 
              strSql.Append(" DjLsh = "+model.DjLsh+","); 
              strSql.Append(" DjBtZdh = "+model.DjBtZdh+","); 
              strSql.Append(" DjFtZdh = "+model.DjFtZdh+","); 
              strSql.Append(" DjStZdh = "+model.DjStZdh+","); 
              strSql.Append(" DjState ='"+ model.DjState+"',"); 
              strSql.Append(" DjCount = "+model.DjCount+","); 
              strSql.Append(" rq ='"+ model.rq+"',"); 
              strSql.Append(" sj ='"+ model.sj+"',"); 
              strSql.Append(" djzt ='"+ model.djzt+"',"); 
              strSql.Append(" xsdh ='"+ model.xsdh+"',"); 
              strSql.Append(" Bmbh ='"+ model.Bmbh+"',"); 
              strSql.Append(" Bmmc ='"+ model.Bmmc+"',"); 
              strSql.Append(" yyybh ='"+ model.yyybh+"',"); 
              strSql.Append(" yyymc ='"+ model.yyymc+"',"); 
              strSql.Append(" khbh ='"+ model.khbh+"',"); 
              strSql.Append(" khmc ='"+ model.khmc+"',"); 
              strSql.Append(" hyk ='"+ model.hyk+"',"); 
              strSql.Append(" hykxf = "+model.hykxf+","); 
              strSql.Append(" slhj = "+model.slhj+","); 
              strSql.Append(" jehj = "+model.jehj+","); 
              strSql.Append(" xj = "+model.xj+","); 
              strSql.Append(" zrje = "+model.zrje+","); 
              strSql.Append(" bqjf = "+model.bqjf+","); 
              strSql.Append(" Zjf = "+model.Zjf+","); 
              strSql.Append(" bz ='"+ model.bz+"',"); 
              strSql.Append(" djyh ='"+ model.djyh+"',"); 
              strSql.Append(" djsj ='"+ model.djsj+"',"); 
              strSql.Append(" xgyh ='"+ model.xgyh+"',"); 
              strSql.Append(" xgsj ='"+ model.xgsj+"',"); 
              strSql.Append(" cszt = "+model.cszt+","); 
              strSql.Append(" yl = "+model.yl+","); 
              strSql.Append(" SalesStatus = "+model.SalesStatus+","); 
              strSql.Append(" Syybh ='"+ model.Syybh+"',"); 
              strSql.Append(" Syymc ='"+ model.Syymc+"',"); 
              strSql.Append(" ssjehj = "+model.ssjehj+","); 
              strSql.Append(" yhk = "+model.yhk+","); 
              strSql.Append(" wx = "+model.wx+","); 
              strSql.Append(" zfb = "+model.zfb+","); 
              strSql.Append(" djq ="+ model.djq+""); 
  			strSql.Append(" where   "); 
  						 
           return strSql.ToString(); 
  		} 
  		 
  		 
  		/// <summary> 
  		/// 删除一条数据 
  		/// </summary> 
  		public bool Delete() 
  		{ 
  			 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("delete from xskdh "); 
  			strSql.Append(" where  "); 
           SqlParameter[] parameters = { };  
  			 
   
  			int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters); 
  			if (rows > 0) 
  			{ 
  				return true; 
  			} 
  			else 
  			{ 
  				return false; 
  			} 
  		} 
  		 
  		/// <summary> 
  		/// 批量删除一批数据 
  		/// </summary> 
  		public bool DeleteList(string lists ) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("delete from xskdh "); 
  			strSql.Append(" where ID in ("+ lists + ")  "); 
  			int rows=DbHelperSQL.ExecuteSql(strSql.ToString()); 
  			if (rows > 0) 
  			{ 
  				return true; 
  			} 
  			else 
  			{ 
  				return false; 
  			} 
  		} 
  		 
  		 
  		/// <summary> 
  		/// 得到一个对象实体 
  		/// </summary> 
  		public xskdh_Entity GetModel() 
  		{ 
  			 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("select  DjLsh,DjBtZdh,DjFtZdh,DjStZdh,DjState,DjCount,rq,sj,djzt,xsdh,Bmbh,Bmmc,yyybh,yyymc,khbh,khmc,hyk,hykxf,slhj,jehj,xj,zrje,bqjf,Zjf,bz,djyh,djsj,xgyh,xgsj,cszt,yl,SalesStatus,Syybh,Syymc,ssjehj,yhk,wx,zfb,djq");			 
  	        strSql.Append("  from xskdh"); 
  			strSql.Append(" where   "); 
           SqlParameter[] parameters = { };  
  			 
  			 
  			xskdh_Entity model=new xskdh_Entity(); 
  			DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters); 
  		        DataTable dt=ds.Tables[0];	  
  				return DataTableToEntity(dt); 
  		} 
  		 
  		 
  		 
  		 
  		/// <summary> 
  		/// 将数据集(DataTable)转换 对象 xskdh_Entity
  		/// 创建人：minjie 
  		/// 创建时间:2019-01-17 01:36:37 
  		/// </summary> 
  		public xskdh_Entity DataTableToEntity(DataTable dt) 
  		{ 
  			xskdh_Entity model=new xskdh_Entity(); 
  			 
  			if(dt!=null&&dt.Rows.Count>0) 
  			{ 
  				if(dt.Rows[0]["DjLsh"]!=null&&dt.Rows[0]["DjLsh"].ToString()!="") 
  				{ 
  					model.DjLsh=int.Parse(dt.Rows[0]["DjLsh"].ToString()); 
  				} 
  				if(dt.Rows[0]["DjBtZdh"]!=null&&dt.Rows[0]["DjBtZdh"].ToString()!="") 
  				{ 
  					model.DjBtZdh=int.Parse(dt.Rows[0]["DjBtZdh"].ToString()); 
  				} 
  				if(dt.Rows[0]["DjFtZdh"]!=null&&dt.Rows[0]["DjFtZdh"].ToString()!="") 
  				{ 
  					model.DjFtZdh=int.Parse(dt.Rows[0]["DjFtZdh"].ToString()); 
  				} 
  				if(dt.Rows[0]["DjStZdh"]!=null&&dt.Rows[0]["DjStZdh"].ToString()!="") 
  				{ 
  					model.DjStZdh=int.Parse(dt.Rows[0]["DjStZdh"].ToString()); 
  				} 
  				model.DjState= dt.Rows[0]["DjState"].ToString(); 
  				if(dt.Rows[0]["DjCount"]!=null&&dt.Rows[0]["DjCount"].ToString()!="") 
  				{ 
  					model.DjCount=int.Parse(dt.Rows[0]["DjCount"].ToString()); 
  				} 
  				if(dt.Rows[0]["rq"]!=null&&dt.Rows[0]["rq"].ToString()!="") 
  				{ 
  					model.rq=DateTime.Parse(dt.Rows[0]["rq"].ToString()); 
  				} 
  				if(dt.Rows[0]["sj"]!=null&&dt.Rows[0]["sj"].ToString()!="") 
  				{ 
  					model.sj=DateTime.Parse(dt.Rows[0]["sj"].ToString()); 
  				} 
  				model.djzt= dt.Rows[0]["djzt"].ToString(); 
  				model.xsdh= dt.Rows[0]["xsdh"].ToString(); 
  				model.Bmbh= dt.Rows[0]["Bmbh"].ToString(); 
  				model.Bmmc= dt.Rows[0]["Bmmc"].ToString(); 
  				model.yyybh= dt.Rows[0]["yyybh"].ToString(); 
  				model.yyymc= dt.Rows[0]["yyymc"].ToString(); 
  				model.khbh= dt.Rows[0]["khbh"].ToString(); 
  				model.khmc= dt.Rows[0]["khmc"].ToString(); 
  				model.hyk= dt.Rows[0]["hyk"].ToString(); 
  				if(dt.Rows[0]["hykxf"]!=null&&dt.Rows[0]["hykxf"].ToString()!="") 
  				{ 
  					model.hykxf=decimal.Parse(dt.Rows[0]["hykxf"].ToString()); 
  				} 
  				if(dt.Rows[0]["slhj"]!=null&&dt.Rows[0]["slhj"].ToString()!="") 
  				{ 
  					model.slhj=decimal.Parse(dt.Rows[0]["slhj"].ToString()); 
  				} 
  				if(dt.Rows[0]["jehj"]!=null&&dt.Rows[0]["jehj"].ToString()!="") 
  				{ 
  					model.jehj=decimal.Parse(dt.Rows[0]["jehj"].ToString()); 
  				} 
  				if(dt.Rows[0]["xj"]!=null&&dt.Rows[0]["xj"].ToString()!="") 
  				{ 
  					model.xj=decimal.Parse(dt.Rows[0]["xj"].ToString()); 
  				} 
  				if(dt.Rows[0]["zrje"]!=null&&dt.Rows[0]["zrje"].ToString()!="") 
  				{ 
  					model.zrje=decimal.Parse(dt.Rows[0]["zrje"].ToString()); 
  				} 
  				if(dt.Rows[0]["bqjf"]!=null&&dt.Rows[0]["bqjf"].ToString()!="") 
  				{ 
  					model.bqjf=decimal.Parse(dt.Rows[0]["bqjf"].ToString()); 
  				} 
  				if(dt.Rows[0]["Zjf"]!=null&&dt.Rows[0]["Zjf"].ToString()!="") 
  				{ 
  					model.Zjf=decimal.Parse(dt.Rows[0]["Zjf"].ToString()); 
  				} 
  				model.bz= dt.Rows[0]["bz"].ToString(); 
  				model.djyh= dt.Rows[0]["djyh"].ToString(); 
  				if(dt.Rows[0]["djsj"]!=null&&dt.Rows[0]["djsj"].ToString()!="") 
  				{ 
  					model.djsj=DateTime.Parse(dt.Rows[0]["djsj"].ToString()); 
  				} 
  				model.xgyh= dt.Rows[0]["xgyh"].ToString(); 
  				if(dt.Rows[0]["xgsj"]!=null&&dt.Rows[0]["xgsj"].ToString()!="") 
  				{ 
  					model.xgsj=DateTime.Parse(dt.Rows[0]["xgsj"].ToString()); 
  				} 
  				if(dt.Rows[0]["cszt"]!=null&&dt.Rows[0]["cszt"].ToString()!="") 
  				{ 
  					model.cszt=int.Parse(dt.Rows[0]["cszt"].ToString()); 
  				} 
  				if(dt.Rows[0]["yl"]!=null&&dt.Rows[0]["yl"].ToString()!="") 
  				{ 
  					model.yl=decimal.Parse(dt.Rows[0]["yl"].ToString()); 
  				} 
  				if(dt.Rows[0]["SalesStatus"]!=null&&dt.Rows[0]["SalesStatus"].ToString()!="") 
  				{ 
  					model.SalesStatus=int.Parse(dt.Rows[0]["SalesStatus"].ToString()); 
  				} 
  				model.Syybh= dt.Rows[0]["Syybh"].ToString(); 
  				model.Syymc= dt.Rows[0]["Syymc"].ToString(); 
  				if(dt.Rows[0]["ssjehj"]!=null&&dt.Rows[0]["ssjehj"].ToString()!="") 
  				{ 
  					model.ssjehj=decimal.Parse(dt.Rows[0]["ssjehj"].ToString()); 
  				} 
  				if(dt.Rows[0]["yhk"]!=null&&dt.Rows[0]["yhk"].ToString()!="") 
  				{ 
  					model.yhk=decimal.Parse(dt.Rows[0]["yhk"].ToString()); 
  				} 
  				if(dt.Rows[0]["wx"]!=null&&dt.Rows[0]["wx"].ToString()!="") 
  				{ 
  					model.wx=decimal.Parse(dt.Rows[0]["wx"].ToString()); 
  				} 
  				if(dt.Rows[0]["zfb"]!=null&&dt.Rows[0]["zfb"].ToString()!="") 
  				{ 
  					model.zfb=decimal.Parse(dt.Rows[0]["zfb"].ToString()); 
  				} 
  				if(dt.Rows[0]["djq"]!=null&&dt.Rows[0]["djq"].ToString()!="") 
  				{ 
  					model.djq=decimal.Parse(dt.Rows[0]["djq"].ToString()); 
  				} 
  				return model; 
  			} 
  			else 
  			{ 
  				return null; 
  			} 
  		} 
  		 
  		/// <summary> 
  		/// 分页获取数据列表 
  		/// </summary> 
  		public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  		 strSql.Append("SELECT * FROM ( "); 
  		 strSql.Append(" SELECT ROW_NUMBER() OVER ("); 
  if (!string.IsNullOrEmpty(orderby.Trim())) 
 { 
    strSql.Append("order by " ); 
 } 
else  
 { 
     strSql.Append("order by  desc"); 
 } 
		 strSql.Append(")AS Row, T.*  from xskdh T "); 
  		 if (!string.IsNullOrEmpty(strWhere.Trim()))  
  			{ 
  			 strSql.Append(" WHERE " + strWhere); 
  			} 
  		    strSql.Append(" ) TT"); 
  	        strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);			return DbHelperSQL.Query(strSql.ToString()); 
  		} 
  		 
  		 
  		/// <summary> 
  		/// 获得数据列表 
  		/// </summary> 
  		public DataSet GetList(string strWhere) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("select * "); 
  			strSql.Append(" FROM xskdh "); 
  			if(strWhere.Trim()!="") 
  			{ 
  				strSql.Append(" where "+strWhere); 
  			} 
  			return DbHelperSQL.Query(strSql.ToString()); 
  		} 
  		 
  		/// <summary> 
  		/// 获得前几行数据 
  		/// </summary> 
  		public DataSet GetList(int Top,string strWhere,string filedOrder) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("select "); 
  			if(Top>0) 
  			{ 
  				strSql.Append(" top "+Top.ToString()); 
  			} 
  			strSql.Append(" * "); 
  			strSql.Append(" FROM xskdh "); 
  			if(strWhere.Trim()!="") 
  			{ 
  				strSql.Append(" where "+strWhere); 
  			} 
  			strSql.Append(" order by " + filedOrder); 
  			return DbHelperSQL.Query(strSql.ToString()); 
  		} 
  		/// <summary> 
  		/// 批量处理  
  		/// </summary> 
  		public int ExecuteSqlTran(List<string> ls,ref string error) 
  		{ 
  			return DbHelperSQL.ExecuteSqlTran(ls,ref   error); 
  		} 
  		 
  		/// <summary> 
  		/// 执行sql语句  
  		/// </summary> 
  		public int ExecuteSql(string sql) 
  		{ 
  			return DbHelperSQL.ExecuteSql(sql); 
  		} 
  		 
  		/// <summary> 
  		/// 执行sql语句  
  		/// </summary> 
  		public string GetSingle(string sql) 
  		{ 
  			object obj= DbHelperSQL.GetSingle(sql); 
  			 if (obj != null) 
  			 { 
  			    return obj.ToString(); 
  		     } 
  		     else 
  		        return ""; 
  		} 
  		 
  		/// <summary> 
  		/// 执行sql语句  
  		/// </summary> 
  		public DataTable  ExecuteDt(string sql) 
  		{ 
  			return DbHelperSQL.ExecuteDt(sql); 
  		} 
  		 
  		 
  		/// <summary> 
  		/// 获得记录条数 
  		/// </summary> 
  		public int GetRecordCount(string strWhere) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("select count(1) "); 
  			strSql.Append(" FROM xskdh "); 
  			if(strWhere.Trim()!="") 
  			{ 
  				strSql.Append(" where "+strWhere); 
  			} 
  		   object obj=	DbHelperSQL.GetSingle(strSql.ToString()); 
  			if(obj!=null && obj.ToString()!="") 
  			{ 
              	return Convert.ToInt32(obj); 
  			} 
  			else 
  			return 0; 
  		} 
   
      
  	} 
  
}
